<?php

namespace app\level;

use plugin\admin\app\model\User;
use plugin\admin\app\model\UserLevel;

class LevelFactory
{
    public static function create($userId)
    {
        $userInfo = User::select(['id', 'level'])->find($userId);
        $levelInfo = UserLevel::where('id', $userInfo['level'])->first();

        return new Level($userId, $levelInfo);
    }
}